#ifndef EC_DATA_H
#define EC_DATA_H

#include <QtCore>

//环控设备EnvironmentControl
class CEcData
{
public:
    bool IsCommNormal();
    bool IsCommFault();

    bool IsRunning();
    bool IsStopped();

    bool IsFault();
    bool IsNoFault();

    bool IsAlarm();
    bool IsNoAlarm();

    bool IsOpening();
    bool IsClosed();

    //获取***的显示文本
    QString GetCommStateText();

    void InitToInvalid();
    void InitToZero();
    void InitToValue(quint16 uvalue, float fvalue);

public:
    quint16 m_uCommState;           //4201 通讯状态 0--正常,1-故障
    quint16 m_uRev[99];
    float m_fRev[100];

    //转发的100个UINT16数据
    // quint16 m_uCommState;        //4201 通讯故障 0正常,1故障
    quint16 m_uRunState;            //4202 运行状态 0运行,1停止
    quint16 m_uFaultState;          //4203 故障状态 0正常,1故障
    quint16 m_uAlarmState;          //4204 告警状态 0正常,1告警
    quint16 m_uSwitchState;         //4205 开关机状态 0已开机,1已关机

    quint16 m_uControlFeedback;     //4206 手动自动反馈
    quint16 m_uFanRunFeedback;      //4207 风机运行反馈
    quint16 m_uElecShutterState;    //4208 电功百叶状态
    quint16 m_uOutFunSwitch;        //4209 外部强制风机打开:0关机,1开启
    quint16 m_uOutFireWarn;         //4210 消防预警:0正常,1预警
    quint16 m_uOutFireSpray;        //4211 外部消防喷洒:0正常,1喷洒
    quint16 m_uOutFireLink;         //4212 外部空调联动:0停止,1启动
    quint16 m_uData[89];            //4210~4400 转发的UINT16数据:预留,数组数量=100-上面的转发数

    //转发的100个FLOAT数据
    float m_fInsideTemp;            //4401 舱内温度℃
    float m_fInsideHumi;            //4403 舱内湿度%
    float m_fOutsideTemp;           //4405 舱外温度℃
    float m_fOutsideHumi;           //4407 舱外湿度%
    float m_fDustDensity;           //4409 灰尘浓度mg/m3
    float m_fData[95];              //4411~4799 转发的FLOAT数据:预留,数组数量=100-上面的转发数

    // 4201     4400	200	UINT16	200	读环控的UNIT16数据	0x03/0x04	无	环控数据
    // 4401     4800	400	FLOAT	200	读环控的FLOAT数据	0x03/0x04	无
    // 21401	21600	200	UINT16	200	写环控的数据	0x03/0x04	0x06

    //21401~21600 设置的数据:预留,数组数量=30-上面的设置数
    quint16 m_uSetData[30];
    quint16 m_uSetDataCopy[30];
};

#endif //EC_DATA_H
